package com.gw.detail.controllor.detail;

import java.util.List;

import com.gw.detail.domain.Vuanz;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.gw.detail.service.IVuanzService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 交警报告中的基本数据Controller
 * 
 * @author WangBin
 * @date 2021-04-30
 */
@RestController
@RequestMapping("/detail/vuanz")
public class VuanzController extends BaseController
{
    @Autowired
    private IVuanzService vuanzService;

    /**
     * 查询交警报告中的基本数据列表
     */
    @PreAuthorize("@ss.hasPermi('detail:vuanz:list')")
    @GetMapping("/list")
    public TableDataInfo list(Vuanz vuanz)
    {
        startPage();
        List<Vuanz> list = vuanzService.selectVuanzList(vuanz);
        return getDataTable(list);
    }

    /**
     * 导出交警报告中的基本数据列表
     */
    @PreAuthorize("@ss.hasPermi('detail:vuanz:export')")
    @Log(title = "交警报告中的基本数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Vuanz vuanz)
    {
        List<Vuanz> list = vuanzService.selectVuanzList(vuanz);
        ExcelUtil<Vuanz> util = new ExcelUtil<Vuanz>(Vuanz.class);
        return util.exportExcel(list, "交警报告中的基本数据数据");
    }

    /**
     * 获取交警报告中的基本数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('detail:vuanz:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(vuanzService.selectVuanzById(id));
    }

    /**
     * 新增交警报告中的基本数据
     */
    @PreAuthorize("@ss.hasPermi('detail:vuanz:add')")
    @Log(title = "交警报告中的基本数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Vuanz vuanz)
    {
        return toAjax(vuanzService.insertVuanz(vuanz));
    }

    /**
     * 修改交警报告中的基本数据
     */
    @PreAuthorize("@ss.hasPermi('detail:vuanz:edit')")
    @Log(title = "交警报告中的基本数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Vuanz vuanz)
    {
        return toAjax(vuanzService.updateVuanz(vuanz));
    }

    /**
     * 删除交警报告中的基本数据
     */
    @PreAuthorize("@ss.hasPermi('detail:vuanz:remove')")
    @Log(title = "交警报告中的基本数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(vuanzService.deleteVuanzByIds(ids));
    }
}
